﻿using System;

namespace SharePhone.Core
{
    [CoreIndex(Property = "UniqueId")]
    public class BaseItem : BaseCoreObject
    {
        #region Properties

        /// <summary>
        /// Gets/sets the title of this item
        /// </summary>
        [CoreField(FieldName = "Title", PopulateRule = CorePopulateRule.Sharepoint,
            Importance = FieldImportance.Optional)]
        public virtual string Title { get; set; }

        /// <summary>
        /// Gets/sets the filename of the item 
        /// </summary>
        [CoreField(FieldName = "FileLeafRef", PopulateRule = CorePopulateRule.SharepointReadOnly,
            Importance = FieldImportance.Optional)]
        public virtual string FileName { get; set; }

        /// <summary>
        /// Gets the creation date for this item
        /// </summary>
        [CoreField(FieldName = "Created_x0020_Date", PopulateRule = CorePopulateRule.SharepointReadOnly,
            Importance = FieldImportance.Required)]
        public virtual DateTime Created { get; set; }

        [CoreField(FieldName = "Author", PopulateRule = CorePopulateRule.SharepointReadOnly,
            Importance = FieldImportance.Required)]
        public virtual string CreatedBy { get; set; }

        [CoreField(FieldName = "CheckoutUser", PopulateRule = CorePopulateRule.SharepointReadOnly,
            Importance = FieldImportance.Optional)]
        public virtual string CheckedOutBy { get; internal set; }

        [CoreField(FieldName = "Editor", PopulateRule = CorePopulateRule.SharepointReadOnly,
            Importance = FieldImportance.Optional)]
        public virtual string ModifiedBy { get; set; }

        [CoreField(FieldName = "Modified", PopulateRule = CorePopulateRule.SharepointReadOnly,
            Importance = FieldImportance.Optional)]
        public virtual DateTime ModifiedDate { get; set; }

        [CoreField(FieldName = "EncodedAbsUrl", PopulateRule = CorePopulateRule.SharepointReadOnly,
            Importance = FieldImportance.Required)]
        public virtual string EncodedAbsoluteURL { get; internal set; }

        [CoreField(FieldName = "ServerUrl", PopulateRule = CorePopulateRule.SharepointReadOnly,
            Importance = FieldImportance.Required)]
        public virtual string ServerRelativeURL { get; internal set; }

        [CoreField(FieldName = "_IsCurrentVersion", PopulateRule = CorePopulateRule.SharepointReadOnly,
            Importance = FieldImportance.Required)]
        public virtual bool IsCurrentVersion { get; internal set; }

        #endregion
    }
}